#include "./leetcode.h"
#include "./uthash.h"
/*
https://leetcode.cn/problems/contains-duplicate/
*/
struct HashTable
{
    int key;
    UT_hash_handle hh;
};

bool containsDuplicate(int* nums, int numsSize)
{
    struct HashTable* hashtable = NULL;
    for (int i = 0; i < numsSize; i++)
    {
        struct HashTable* temp;
        HASH_FIND_INT(hashtable, nums + i, temp);
        if (temp == NULL)
        {
            temp = malloc(sizeof(struct HashTable));
            temp->key = nums[i];
            HASH_ADD_INT(hashtable, key, temp);
        }
        else
        {
            return true;
        }
    }
    return false;
}